Des-file format
des-file format is the language which is used to describe the special levels for NetHack. It is compiled into a binary file by lev_comp. There are two types of levels you can create: mazes and rooms. For MAZE-type levels you "draw" one or more maps with ASCII characters and then describe the monsters, objects and so on that are in the map. For ROOM-type levels, you describe rooms and their contents. The maze-levels are easier to make and understand, and room-type levels do not offer as much control over the level. Language syntax All lines beginning with # are comments and are ignored by the level compiler, except between MAP and ENDMAP. Example: # This is a comment. MAZE-type levels Maze-type levels begin with MAZE, followed with optional FLAGS, optional INIT_MAP, 0 or more MESSAGEs and up to 9 maze-parts, each of which consists either of NOMAP or GEOMETRY and MAP, followed by zero or more the random register initializers, one of each (RANDOM_MONSTERS, RANDOM_OBJECTS, RANDOM_PLACES), followed by zero or more of the map details (everything else, eg. MONSTER, OBJECT, TRAP, etc.) That is: *MAZE *FLAGS, optional *INIT_MAP, optional *MESSAGE, 0 or more *up to 9 map-parts, which consist of: **NOMAP or GEOMETRY and MAP **RANDOM_MONSTERS, optional **RANDOM_OBJECTS, optional **RANDOM_PLACES, optional **The rest of the definitions of this map-part Example: MAZE:"test",' ' FLAGS:noteleport MESSAGE:"Welcome!" GEOMETRY:center,center MAP ..... .L.L. ..... .L.L. ..... ENDMAP MONSTER:random,random,random OBJECT:'%',random,random MAZE MAZE:"foo",'X' *foo is the unique file name which will be used for this special level, up to 8 characters. For example: soko3-2. *'X' is the fill map character. The map will be filled with this dungeon feature before anything else is done. Example: MAZE:"soko3-2",' ' FLAGS FLAGS:flaglist flaglist is one or more of the following flags, separated by commas *noteleport: Player cannot teleport within the level. *hardfloor: The floor is too hard to dig. *nommap: magic mapping does not work. *arboreal: supposedly an outdoor map. Basically solid walls will be trees, and corridors are not used. *shortsighted: Monsters cannot see you from far away. Example: FLAGS:noteleport,hardfloor INIT_MAP INIT_MAP:'X', 'Y', smoothed, joined, lighted, walled This causes the level map to be initialized with a random map generator, similar to how the random Gnomish Mines look like. Each MAZE-level can contain only 0 or 1 of these definitions. *'X' is the "foreground" fill map character. *'Y' is the "background" fill map character. *smoothed is either true or false, and denotes whether the level will be "smoothed" *joined is either true or false, and denoted whether the level will be "joined". *lighted is either lit, unlit, or random *walled is either true or false. Examples: INIT_MAP: 'L', '.', false, false, unlit, false INIT_MAP: '.', ' ', true, true, random, true MESSAGE MESSAGE:"string" You can have 0 or more of these per special level. "string" is any message you want player to see when entering the level. Example: MESSAGE: "Well done, mortal!" NOMAP NOMAP Instead of GEOMETRY and MAP, you use this if you think that INIT_MAP creates a good enough random map and you don't want to use any fixed map-parts. GEOMETRY GEOMETRY:xadj,yadj This must be followed by a MAP definition, and tells the approximate position of the following MAP-part on the level. *xadj is one of left, half-left, center, half-right, right or random *yadj is one of top, center, bottom or random Example: GEOMETRY:left,top MAP MAP ... ... ... ENDMAP This must be preceded by GEOMETRY definition. You define a map-part by "drawing" with map characters between the MAP and ENDMAP. The map can be up to 21 lines high and and each line can be up to 76 chars long. Each line must also be the same length. OBJECT OBJECT:'X',"name",place Each map-part can contain any number of object definitions. *'X': a character denoting one of the object classes. *"name": either an object name as listed in objects.c, or random *place: either a coordinate, a RANDOM_PLACES place, or random Examples: OBJECT:'%',"food ration",random OBJECT:'*',random,(10,10) OBJECT:'?',"genocide",place0 NON_DIGGABLE NON_DIGGABLE:region Sets the walls inside the region as non-diggable. Example: NON_DIGGABLE:(00,00,13,12) NON_PASSWALL NON_PASSWALL:region Players and monsters cannot phase through the walls inside the region Example: NON_PASSWALL:(00,00,13,12) TRAP TRAP:"name",place *"name" is the trap's name, or random *place is either a coordinate, a RANDOM_PLACES place, or random Examples: TRAP:"hole",(12,10) TRAP:"anti magic",random TRAP:random,random MONSTER MONSTER:'X',"name",place *'X' is the monster class symbol, or random, or a RANDOM_MONSTERS index *"name" is the specific monster, or random *place is either a coordinate, a RANDOM_PLACES place, or random You can also put some other things in there to further define the monster. See the examples below. Examples: MONSTER:'v',"dust vortex",(42,05) MONSTER:'E',"earth elemental",(39,06),peaceful MONSTER:'&',"Pestilence",place0,hostile MONSTER:random,random,random MONSTER:random,random,(01,01), asleep MONSTER:monster0,random,(27,05) MONSTER:'m',"giant mimic",place1,m_feature "fountain" MONSTER:'m',random,place0, m_object "luckstone" MONSTER:'@',"rogue",(35,06),peaceful,"Pug" RANDOM_PLACES RANDOM_PLACES:place,... With this command you can set up to 10 coordinate registers, which you can access by using placeN instead of a coordinate in any other command. The registers are shuffled at level creation time. Example: RANDOM_PLACES:(23,9),(37,14),(51,9) OBJECT:'?',"genocide",place0 RANDOM_MONSTERS RANDOM_MONSTERS:'X',... With this command you can set up 10 monster symbol registers, which you can access by using monsterN instead of a monster symbol in any other command. The registers are shuffled at level creation time. Example: RANDOM_MONSTERS: 'E', 'X' MONSTER:monster0,random,(27,05) RANDOM_OBJECTS RANDOM_OBJECTS:'X',... With this command you can set up 10 object class symbol registers, which you can access by using objectN instead of a object class symbol in any other command. The registers are shuffled at level creation time. Example: RANDOM_OBJECTS:'OBJECT:object[0,random,(39,05) DOOR DOOR:state,place Puts a door on the map. *state is one of the following: nodoor, locked, closed, open or random *place is either a coordinate, a RANDOM_PLACES place, or random Example: DOOR:locked,(10,5) DRAWBRIDGE DRAWBRIDGE:place,dir,state *place is either a coordinate, a RANDOM_PLACES place, or random *dir is one of the following: north, east, south or west *state is one of the following: nodoor, locked, closed, open or random Note that the drawbridge placement is different from door placement; the coordinate must be a place where the drawbridge would be when it's open, and from that place towards the direction there should be a wall, where the portcullis will be. Example: DRAWBRIDGE:(25,18), north, closed REGION REGION:(x1,y1,x2,y2), lighted, type Define a region on the map with certain light-state and type. *lighted is either lit or unlit. *type is one of the room types. You can also add some other things to the definition. Examples: REGION:(43,12,49,16),unlit,"ordinary" REGION:(12,01,20,09),unlit,"morgue",unfilled REGION:(11,03,29,10),lit,"temple",filled,true ROOM-type levels Common syntax Map characters Trap names "anti magic", "arrow", "bear", "board", "dart", "falling rock", "fire", "hole", "land mine", "level teleport", "magic portal", "magic", "pit", "polymorph", "rolling boulder", "rust", "sleep gas", "spiked pit", "statue", "teleport", "trap door", "web" Room types "ordinary", "throne", "swamp", "vault", "beehive", "morgue", "barracks", "zoo", "delphi", "temple", "anthole", "cocknest", "leprehall", "shop", "armor shop", "scroll shop", "potion shop", "weapon shop", "food shop", "ring shop", "wand shop", "tool shop", "book shop", "candle shop" Category:Annotations